<?php
	/*****************************************************************
		GP Clinic - a web based Medical directory system
		Copyright (C) 2014 Kaizensynergy - Gemba360

		Author: Bless Bauson
		Key: bHkTy89wZ0DHyUiim0041rTxyBbP671aQwg327UtjfcrO
	*****************************************************************/

	$addParams = array(
					'url' 		  => APP_ROOT.'/new-categories', 
					'titleHead'   => 'Create New User Type / Category', 
					'widthParam'  => 480, 
					'heightParam' => 430
				);
	$add = htmlentities(json_encode($addParams));

	$obj = new UserType();
	if($_SERVER['REQUEST_METHOD'] == "POST"){
		if(isset($_POST['inactive']) && $_POST['inactive'] == 1){
			$obj->filter = "user_type.active <= 1";
		}else{
			$obj->filter = "user_type.active = 1";
		}

		if(isset($_POST['keyword']) && !empty($_POST['keyword'])){
			$obj->SQL_AddFilter("user_type.label LIKE '%".$_POST['keyword']."%'");
		}
	}

	//view all using pagination
	$query 		= $obj->SQL_FormQuery();
	$cntrows	= $obj->SQL_Count();

	//form pagination
	$rowcntPerPage  = CONST_PAGE_ROW_COUNT;
	$listObj = new Pagination(
				$query,				//query resultset
				$rowcntPerPage,		//max # of rows displayed
				'page',				//pagination variable used in GET or POST
				5					//number of links displayed in getPageNav
			);
?>